package com.akaovi.exp;

import com.akaovi.common.util.Utils;

/**
 * @author akaovi
 * @version 1.0
 * @description
 * @date 2022/10/31 14:43
 * @since 2022/10/31 14:43
 */
public class ExpMain {
    public static void main(String[] args) {
        while (true) {
            try {
                System.out.print("输入三个数，一个空格间隔: ");
                String threeNum = Utils.getThreeNum();
                String[] s = threeNum.split(" ");
                for (String value : s) {
                    Utils.isNumber(value);
                }
                int[] num = new int[3];
                for (int i = 0; i < s.length; i++) {
                    num[i] = Integer.parseInt(s[i]);
                    Utils.isGReaterThanZore(num[i]);
                }
                int a = num[0], b = num[1], c = num[2];
                Utils.isTriangle(a, b, c);
                System.out.printf("三角形的面积: %f\n", 1 / (4 * Math.sqrt((a + b + c) * (a + b - c) * (a + c - b) * (b + c - a))));
                break;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
